#include "sylar/sylar.h"


sylar::Logger::LoggerPtr g_logger = SYLAR_LOG_ROOT();

void test_fiber()
{
    static int s_count = 5;
    SYLAR_LOG_INFO(g_logger) << "test in fiber s_count=" << s_count;

    sleep(1);
    if(--s_count >= 0) 
    {
        sylar::Scheduler::GetThis()->schedule(&test_fiber, sylar::GetThreadId());
    }
}

int main(int argc, char* argv[])
{
    sylar::Scheduler sc(3, true, "test");
    
    sc.start();
    sleep(3);
    sc.schedule(&test_fiber, 1);
    sc.stop();
    return 0;
}